package com.sky.mapper.admin;

import com.sky.pojo.SetmealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {


    /**
     * 批量插入套餐菜品关系数据
     */
    void insert(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id删除套餐菜品关系数据
     */
    void delete(List<Long> ids);

    /**
     * 根据套餐id查询套餐菜品关系数据
     */
    List<SetmealDish> queryById(Integer id);

    /**
     * 根据套餐id查询包含的菜品
     */
    @Select("select sd.name, sd.copies, d.image, d.description \n" +
            "from setmeal_dish sd left join dish d on sd.dish_id = d.id\n" +
            "where sd.setmeal_id = #{setmealId}")
    List<DishItemVO> querySetmealDish(Integer setmealId);
}
